import numpy as np
from matplotlib import pyplot as plt
plt.figure(figsize=(9,6))
n = 8
X = np.arange(n)+1

Y1 = np.random.uniform(0.5,1.0,n)
Y2 = np.random.uniform(0.5,1.0,n)
Y1 = [0.161,0.142,0.155,0.168,0.136,0.141,0.153,0.160]
Y2 = [0.873,0.892,0.874,0.870,0.906,0.894,0.869,0.881]
Y3 = [0.886,0.912,0.898,0.894,0.933,0.925,0.897,0.908]
loss = plt.bar(X,Y1,width = 0.25,facecolor = 'lightskyblue',edgecolor = 'white')
auc = plt.bar(X+0.25,Y2,width = 0.25,facecolor = 'yellowgreen',edgecolor = 'white')
initial = plt.bar(X+0.5,Y3,width = 0.25,facecolor = 'darkgreen',edgecolor = 'white')
for x,y in zip(X,Y1):
    plt.text(x+0.25, y+0.02, '%.3f' % y, ha='center', va= 'bottom')

for x,y in zip(X,Y2):
    plt.text(x+0.3, y+0.01, '%.3f' % y, ha='center', va= 'bottom')
for x,y in zip(X,Y3):
    plt.text(x+0.6, y+0.05, '%.3f' % y, ha='center', va= 'bottom')
plt.legend((loss,auc,initial,),(u"Loss Rate",u"Reduction Auc Area",u"No Reduction Auc Area"))
plt.ylabel('Rate')
plt.xlabel('Patient')
plt.title('Result Comparison')
plt.ylim(0,+1.25)
plt.show()